package com.yupi.project.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yupi.model.entity.InterfaceInfo;
import com.yupi.project.common.ErrorCode;
import com.yupi.project.exception.BusinessException;
import com.yupi.project.mapper.InterfaceInfoMapper ;
import com.yupi.project.service.InterfaceInfoService ;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

/**
* @author Administrator
* @description 针对表【interface_info(接口信息表)】的数据库操作Service实现
* @createDate 2024-07-26 15:39:41
*/
@Service
public class InterfaceInfoServiceImpl extends ServiceImpl<InterfaceInfoMapper, InterfaceInfo>
    implements InterfaceInfoService{

    @Override
    public void validinterfaceinfo(InterfaceInfo interfaceinfo, boolean b) {
        final String interfaceinfoName = interfaceinfo.getName();
        if(StringUtils.isBlank(interfaceinfoName)){
            throw new BusinessException(ErrorCode.PARAMS_ERROR,"接口名为空");
        }
        final String interfaceinfoDescription = interfaceinfo.getDescription();
        if(StringUtils.isBlank(interfaceinfoDescription)){
            throw new BusinessException(ErrorCode.PARAMS_ERROR,"接口描述为空");
        }
        final String interfaceinfoRequestParams = interfaceinfo.getRequestParams();
        if(StringUtils.isBlank(interfaceinfoRequestParams)){
            throw new BusinessException(ErrorCode.PARAMS_ERROR,"接口参数为空");
        }
        final String interfaceinfoUrl = interfaceinfo.getUrl();
        if(StringUtils.isBlank(interfaceinfoUrl)){
            throw new BusinessException(ErrorCode.PARAMS_ERROR,"接口url为空");
        }
        final String interfaceinfoRequestHeader = interfaceinfo.getRequestHeader();
        if(StringUtils.isBlank(interfaceinfoRequestHeader)){
            throw new BusinessException(ErrorCode.PARAMS_ERROR,"接口请求头为空");
        }
        final String interfaceinfoResponseHeader = interfaceinfo.getResponseHeader();
        if(StringUtils.isBlank(interfaceinfoResponseHeader)){
            throw new BusinessException(ErrorCode.PARAMS_ERROR,"接口响应头为空");
        }
        final String interfaceinfoMethod = interfaceinfo.getMethod();
        if(StringUtils.isBlank(interfaceinfoMethod)){
            throw new BusinessException(ErrorCode.PARAMS_ERROR,"接口方法为空");
        }
    }
}




